import { EDefineObjType } from "../common/EDefineObjType";

export class NodeTypeHelper {

    static GetNodeType(node: Laya.Node): EDefineObjType {
        if (node instanceof Laya.Stage) {
            return EDefineObjType.Stage;
        } else if (node instanceof Laya.Sprite) {
            if (node instanceof Laya.Scene3D) {
                return EDefineObjType.Scene3D;
            } else {
                return EDefineObjType.Sprite;
            }
        } else if (node instanceof Laya.Sprite3D) {
            if (node instanceof Laya.Camera) {
                return EDefineObjType.Camera;
            } else if (node instanceof Laya.LightSprite) {
                return EDefineObjType.Light;
            } else {
                return EDefineObjType.Sprite3D;
            }
        } else {
            console.error("未处理的node类型", node);
            return EDefineObjType.Node;
        }
    }

    static GetTypeName(type: EDefineObjType): string {
        switch (type) {
            case EDefineObjType.Node:
                return 'Node';
            case EDefineObjType.Sprite:
                return 'Sprite';
            case EDefineObjType.Sprite3D:
                return 'Sprite3D';
            case EDefineObjType.Stage:
                return 'Stage';
            case EDefineObjType.Camera:
                return 'Camera';
            case EDefineObjType.Light:
                return 'Light';
            case EDefineObjType.Scene3D:
                return 'Scene3D';
            default:
                console.error("未处理的type:", type);
                return 'Node';
        }
    }

}